package com.example.fill;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.window.SplashScreen;

import androidx.activity.ComponentActivity;
import androidx.activity.result.ActivityResultLauncher;
import androidx.appcompat.app.AppCompatActivity;

import com.example.fill.Test240126.Commend;
import com.example.fill.Test240126.LineView;
import com.example.fill.Test240126.Listener;
import com.example.fill.Test240126.Transaction;
import com.example.fill.databinding.TestBinding;
import com.example.fill.databinding.TitleBinding;
import com.example.fill.databinding.V240124Binding;
import com.example.fill.output.CommOutput;
import com.example.fill.output.Test;
import com.example.fill.output.XlsType;
import com.example.fill.xui.StatusBarUtils;
import com.example.fill.xui.Vkkkkkkkkkk;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.kyle.radiogrouplib.NestedRadioLayout;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class MainActivity2 extends ComponentActivity {


    static List<List<Test>> data = new ArrayList<>();
    static List<String> title = new ArrayList<>();

    static {
        //第一页
        data.add(Arrays.asList(
                new Test("小米", 22, false, System.currentTimeMillis()),
                new Test("小黑", 12, true, new Date().getTime()),
                new Test("小黄", 88, true, Calendar.getInstance().getTime().getTime())
        ));
        //第二页
        data.add(Arrays.asList(
                new Test("小米", 22, false, System.currentTimeMillis()),
                new Test("小黑", 12, true, new Date().getTime()),
                new Test("小黄", 88, true, Calendar.getInstance().getTime().getTime())
        ));
        //第三页
        data.add(Arrays.asList(
                new Test("小米", 22, false, System.currentTimeMillis()),
                new Test("小黑", 12, true, new Date().getTime()),
                new Test("小黄", 88, true, Calendar.getInstance().getTime().getTime())
        ));
        title.addAll(Arrays.asList("名字", "年龄", "是否成年", "记录时间"));
    }

//    TestBinding binding;

    //    TitleBinding binding;
    V240124Binding binding;
    private View240126 lineView;
    private FloatingActionButton flow;


    private NestedRadioLayout r1;
    private NestedRadioLayout r2;


    boolean io = true;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
//        androidx.core.splashscreen.SplashScreen.installSplashScreen(this);

        super.onCreate(savedInstanceState);

//        WindowManager.LayoutParams attributes = getWindow().getAttributes();
//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
//            attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
//        }

//        setContentView(R.layout.fsgxvz);
//        r1 = (NestedRadioLayout) findViewById(R.id.r1);
//        r2 = (NestedRadioLayout) findViewById(R.id.r2);
//
//        r1.setChecked(true);

        setContentView(R.layout.sdfgdas);

        lineView = (View240126) findViewById(R.id.lineView);
        flow = (FloatingActionButton) findViewById(R.id.flow);
        flow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                io = !io;
            }
        });
        Transaction transaction = new Transaction(new Listener() {
            @Override
            public void onSend(Commend commend) {
                if (io){
                    lineView.addCommend(commend);
                }
            }

            @Override
            public void onReceive(Commend commend) {

            }

            @Override
            public void onTimeOut(Commend commend) {

            }

            @Override
            public void onUnknown(Commend commend) {

            }
        });

        transaction.start();

//        long l = System.currentTimeMillis();
//        List<Commend> commends = Arrays.asList(
//                new Commend().setPushTime(l),
//                new Commend().setPushTime(l + 1000)
//                        .setNoBack(false)
//                        .setBackTime(l + 8000),
//                new Commend().setPushTime(l + 2000),
//                new Commend().setPushTime(l + 3000),
//                new Commend().setPushTime(l + 4000),
//                new Commend().setPushTime(l + 5000)
//                        .setNoBack(false)
//                        .setBackTime(l + 8000),
//                new Commend().setPushTime(l + 6000)
//                        .setNoBack(false)
//                        .setBackTime(l + 8000),
//                new Commend().setPushTime(l + 7000)
//                        .setNoBack(false)
//                        .setBackTime(l + 8000),
//                new Commend().setPushTime(l + 8000)
//                        .setNoBack(false)
//                        .setBackTime(l + 8000),
//                new Commend().setPushTime(l + 9000)
//                        .setNoBack(false)
//                        .setBackTime(l + 8000),
//                new Commend().setPushTime(l + 10000)
//                        .setNoBack(false)
//                        .setBackTime(l + 8000)
//        );
//        lv.setBean(commends);

//        StatusBarUtils.fullScreen(this);
//        StatusBarUtils.translucent(this);
//        setContentView(new StrLayout(this));
//        setContentView(new V24111(this));
//        setContentView(new StrLayoutTexture(this));
//setContentView(R.layout.sdfg);
//        setContentView(R.layout.title);
//        binding = TitleBinding.inflate(getLayoutInflater());
//        binding = V240124Binding.inflate(getLayoutInflater());
//        setContentView(binding.getRoot());
//        startActivity(new Intent(MainActivity2.this,MainActivity3.class));

//        MusicUtils.adjustVolume(this,50);
//        MusicUtils.playMusic(this);
//        binding.bt.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
////                new CommOutput<>(
////                        MainActivity2.this,
////                        data,
////                        Test.class,
////                        title,
////                        "名单输出",
////                        new XlsType()
////                ).execute();
//                //startActivity(new Intent(MainActivity2.this,MainActivity3.class));
//                SportPermissionUtil sportPermissionUtil = new SportPermissionUtil();
//                Method[] declaredMethods = SportPermissionUtil.class.getDeclaredMethods();
//                for (Method declaredMethod : declaredMethods) {
//                    try {
//                        declaredMethod.invoke(sportPermissionUtil,MainActivity2.this);
//                    } catch (IllegalAccessException | InvocationTargetException e) {
//                        throw new RuntimeException(e);
//                    }
//                }
//            }
//        });
//        binding = TestBinding.inflate(getLayoutInflater());
//        setContentView(binding.getRoot());
//
//        BaseRecyclerAdapter<Bean> adapter = new BaseRecyclerAdapter<Bean>() {
//            @Override
//            protected void bindData(@NonNull RecyclerViewHolder holder, int position, Bean item) {
//                holder.text(android.R.id.text1,item.getTitle());
//                holder.text(android.R.id.text2,item.getContent());
//            }
//
//            @Override
//            protected int getItemLayoutId(int viewType) {
//                return android.R.layout.simple_list_item_2;
//            }
//        };
//        binding.listView.setLayoutManager(new LinearLayoutManager(this));
//        binding.listView.setAdapter(adapter);
//
//        ArrayList<Bean> beans = new ArrayList<>();
//
//        for (int i = 0; i < 30; i++) {
//            beans.add(new Bean(i,"Hello","Java"));
//        }
//        adapter.refresh(beans);
//        //binding.listView.addItemDecoration(new DividerItemDecoration(this,LinearLayoutManager.VERTICAL,2,R.color.md_theme_dark_background,20));
//        //binding.listView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));
//        binding.listView.addItemDecoration(new StickyItemDecoration(new StickyHeadContainer(this),-1));
    }

//    @Override
//    protected void onResume() {
//        super.onResume();
//        StatusBarUtils.fullScreen(this);
//
//    }


}